package com.cmower.javapoint.javatutorial.eighteen;

/**
 * @author 沉默王二，一枚有趣的程序员
 */
public class BreakDemo {
    public static void main(String[] args) {
        for (int i = 1; i <= 10; i++) {
            if (i == 5) {
                break;
            }
            System.out.println(i);
        }

        for (int i = 1; i <= 3; i++) {
            for (int j = 1; j <= 3; j++) {
                if (i == 2 && j == 2) {
                    break;
                }
                System.out.println(i + " " + j);
            }
        }

        int i = 1;
        while (i <= 10) {
            if (i == 5) {
                i++;
                break;
            }
            System.out.println(i);
            i++;
        }

int j = 1;
do {
    if (j == 5) {
        j++;
        break;
    }
    System.out.println(j);
    j++;
} while (j <= 10);
    }
}
